import HyRequest from "@/service";
import { da } from "element-plus/es/locale";

// 员工方面接口
enum EmployeeAPI {
  EmployeeSave = "/employee/save",
  EmployeeList = "/employee/employeCount",
  UploadImage = "/Oss/setAvatar",
  DeleteEmployee = "/employee/deleteEmploye",
  EditEmployee = "/employee/updateEmploye"
}
export function getPageListData(queryinfo: any) {
  console.log(queryinfo);
  return HyRequest.get<any>({
    url: `${EmployeeAPI.EmployeeList}?start=${queryinfo.queryinfo.start}&end=${queryinfo.queryinfo.end}`
  });
}
// 请求添加员工接口
export function postEmployeeData(queryinfo: any) {
  return HyRequest.post({
    headers: { "Content-Type": "multipart/form-data" },
    url: EmployeeAPI.EmployeeSave,
    data: queryinfo
  });
}
// 根据id删除员工接口
export function deletePageDataById(queryinfo: any) {
  return HyRequest.get({
    url: `${EmployeeAPI.DeleteEmployee}?id=${queryinfo.id}`
  });
}
// 上传员工图片接口
export function uploadAvatar(data: any) {
  return HyRequest.post<any>({
    url: EmployeeAPI.UploadImage, // 接口地址
    data: data
  });
}
// 新建员工
export function editPagedata(data: any) {
  console.log(data);
  return HyRequest.get<any>({
    url: `${EmployeeAPI.EditEmployee}?id=${data.id}&nickname=${data.nickname}&phone=${data.phone}`// 接口地址
    // data: {
    //   id: data.id,
    //   gender: data.gender,
    //   nickname: data.nickname,
    //   phone: data.phone
    // }
  });
}
